<template>
	<view class="contact">
		<view class="list">
			<view v-for="(item1,index) in dataInfo" :key='index'>{{item1}}</view>
		</view>
		<button @click="next">
			再看一条
		</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				item:{},
				dataInfo:''
			}
		},
		methods: {
			init(){
				let that =this
				uni.request({
					url: `https://api.oddfar.com/yl/q.php?c=${that.item.code}&encode=text`,
					method: "GET",
					success: function(res) {
						that.dataInfo =res.data.split('<br>')
					}
				})
				uni.setNavigationBarTitle({
				    title: that.item.name
				});
			},
			next(){
				this.init()
			}
		},
		onLoad(option) {
			this.item=JSON.parse(decodeURIComponent(option.obj));
			this.init()
			
		}
	}
</script>

<style lang="scss" scoped>
	.contact{
		position: relative;
		height: 100%;
		padding: 10upx;
		.list{
			padding: 100upx 30upx;
			font-size: 32upx;
			background-color: #fff;
			margin-top: 30upx;
			color:#8A2BE2 ;
			padding: 20upx;
			border-radius: 20upx;
			margin-bottom: 100upx;
			view{
				padding: 20upx 0;
				line-height: 50upx;
				
			}
		}
	}
	button{
		width: 80%;
		height: 82upx;
		line-height: 82upx;
		border-radius: 15upx;
		font-size: 32upx;
		font-family: Source Han Sans CN;
		font-weight: 500;
		color: rgba(255, 255, 255, 1);
		text-align: center;
		position: fixed;
		bottom: 30upx;
		left: 50%;
		transform: translateX(-50%);
		background-color: #8A2BE2;
	}
</style>
